package com.springboot.study.consumer;
import com.springboot.study.config.FanoutConfig;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
/**
 * 消费者（订阅者） - 广播模式
 */
@Component
public class FanoutConsumer {
    /**
     * 队列1接收广播消息
     */
    @RabbitListener(queues = FanoutConfig.FANOUT_QUEUE_1)
    public void receiveFromQueue1(String message) {
        System.out.println("队列1收到广播消息：" + message);
    }
    /**
     * 队列2接收广播消息
     */
    @RabbitListener(queues = FanoutConfig.FANOUT_QUEUE_2)
    public void receiveFromQueue2(String message) {
        System.out.println("队列2收到广播消息：" + message);
    }
}
